<?php 
	session_start(); 
	include('../user_type/system.php');
	include('../user_type/member.php');
	include('../user_type/moderator.php');
	include('../access/login_functions.php');
	include("../access/opendb.php"); 
	$_SESSION['restricted'] = true;
	check_logged_in();		if ($_SESSION['Status'] != "NewModerator") { send_to_page($_SESSION['curPage']); }
	
	
	$id = intval($_SESSION['ID']);
	$stopWords = trim($_POST['stopWords']);
	$stopWords = explode(',', $stopWords);
	$numWords = count($stopWords);
	
	// add to stopword_table
	for ($i = 0; $i < $numWords; $i++)
		Moderator::EditStopWordList($id, 'add', $stopWords[$i]);

	// transform NewModerator into Moderator
	$_SESSION['statusMessage'] = "Your words have been added to the database! You may now begin using our product!";
	$result = mysql_query("UPDATE user_table SET status='Moderator' WHERE UID=$id");

	$_SESSION['Status'] = "Moderator";
	send_to_page("../home.php");
?>